import java.util.Scanner;

public class Main7 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        String line = input.nextLine();

        line = Case(line);

        String[] lines = line.split("");
        for (int i = lines.length - 1; i >= 0; i--) {
            System.out.print(lines[i]);
        }
    }

    public static String Case(String str) {
        StringBuilder convertedStr = new StringBuilder();

        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (Character.isUpperCase(ch)) {
                convertedStr.append(Character.toLowerCase(ch));
            } else if (Character.isLowerCase(ch)) {
                convertedStr.append(Character.toUpperCase(ch));
            } else {
                convertedStr.append(ch);
            }
        }

        return convertedStr.toString();
    }
}
